<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/react.development.js"></script>
    <script src="../lib/react-dom.development.js"></script>
    <script src="../lib/babel.min.js"></script>
</head>
<!-- 2.创建一个舞台 -->
<div id="root">

</div>

<body>
    <script type="text/babel">
        const root = ReactDOM.createRoot(document.getElementById('root'));
        /*  p 标签里面不能放Div */
        const oDiv = (
            <div>我是div</div>
        );
        const  flag = true;
        const isLoading = true;
        const age = 20;
        function friends(age) {
            if (age > 18){
                return <div>青年</div>
            }else {
                return <div>其他年龄段</div>
            }
        }
        root.render((
            <div>
                <h3>插值表达式也可以渲染react元素</h3>
                {oDiv}
                <hr/>
                <h3>单分支</h3>
                {flag && <div>一起看电影</div>}
                <h3>双分支</h3>
                {isLoading? <h3>页面正在加载中..</h3>: <h3>页面内容</h3>}
                <h3>多分支</h3>
                {friends(age)}
                <hr/>
                <h3>其他写法</h3>

            </div>
        ));
    </script>
</body>
</html>